﻿@using CNKI.TPI.Web.Base
@using CNKI.TPI.Web.Search.IBLL
@{
    Layout = null;
}
<script>
    // 收缩展开效果
    function showul() {

        if ($('#moredb').css("display") == "none") {
            $('#moredb').show();
            $('#clickshow').html("折叠<i class=\"iconfont\">&#xe613;</i>");
        }
        else {
            $('#moredb').hide();
            $('#clickshow').html("展开<i class=\"iconfont\">&#xe611;</i>");
        }
    }

</script>
@{
    if (ViewBag.SearchResultDoc != null && ViewBag.SearchResultDoc.Rows.Count > 0)
    {
        int typedb = ViewBag.DbType;
        //首页推荐，首页公告,文章新闻   
        if (@ViewBag.Type == (int)ShowType.ArticleRecommend || @ViewBag.Type == (int)ShowType.Notice || @ViewBag.Type == (int)ShowType.ArticleNews)
        {
            if (@ViewBag.Type == (int)ShowType.ArticleNews)//如果是文章新闻类型，则跳转到新闻详情页
            {
                typedb = (int)MediaType.News;
            }
    <ul>

        @foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
        {
            <li class='li-bg'>
                <a target="_blank" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@typedb&sysID=@dr["SYS_FLD_SYSID"]">
                    @Html.Raw(ColumnAliasHelper.SubContent(@dr[0].ToString(), @ViewBag.Len))</a>
            </li>
        }
    </ul>
        if (@ViewBag.Location == 1) //如果是右侧模板则显示更多，左侧模板已经在index页加了更多选项
        {
            if (@ViewBag.Type == (int)ShowType.ArticleNews)
            {
    <a class="more" target="_blank" href="~/SingleSearch?id=@ViewBag.DbID&name=@ViewBag.DbName&mediaType=@((int)MediaType.Doc)&displayDBName=@ViewBag.DisplayDBName&autoLoad=1">更多</a> 
            }
            else
            {
    <a class="more" target="_blank" href="~/SingleSearch?id=@ViewBag.DbID&name=@ViewBag.DbName&displayDBName=@ViewBag.DisplayDBName&autoLoad=1">更多</a>
            }
        }
        }
        //图片推荐
        else if (@ViewBag.Type == (int)ShowType.PicRecommend)
        {
            int tb = ViewBag.DbType;
            string astyle = "width:210px;height:137px";
            int imgwidth = 210;
            int imgheigh = 137;
            if (@ViewBag.Location == 0)//左侧模板
            {
    <ul>
        @foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
        {
            <li class='col-md-4'><a target="_blank" style="@astyle" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@tb&sysID=@dr["SYS_FLD_SYSID"]">
                <img width="@imgwidth" height="@imgheigh" src="@ResourceHelper.GetFirstSmallPicURL(@ViewBag.DbID, int.Parse(@dr["SYS_FLD_SYSID"].ToString()))"/></a>
                <div class="zhezhao">@Html.Raw(ColumnAliasHelper.SubContent(dr[0].ToString(), @ViewBag.Len))</div>
            </li>
        }
    </ul>
            }
            else//右侧模板
            {   
    <ul>
        @foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
        {
            <li><a target="_blank" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@tb&sysID=@dr["SYS_FLD_SYSID"]">
                @Html.Raw(ColumnAliasHelper.SubContent(dr[0].ToString(), @ViewBag.Len))
            </a>
            </li>
        }
    </ul>
    <a class="more" target="_blank" href="~/SingleSearch?id=@ViewBag.DbID&name=@ViewBag.DbName&displayDBName=@ViewBag.DisplayDBName&autoLoad=1">更多</a>
            }
        }
        //图片新闻
        else if (@ViewBag.Type == (int)ShowType.PicNews)
        {
            if (@ViewBag.Location == 1)//右侧模板
            {
    <script src="~/Scripts/js.js"></script>
                //第一行作为图片显示
    <div class="huxi huxi1">
        @if (ViewBag.FileInfoHome != null && ViewBag.FileInfoHome.Count > 0)
        {
            <div class="tupianliebiao">
                <ul>
                    @foreach (CNKI.TPI.Web.Search.Model.METADATA_FILE item in ViewBag.FileInfoHome)
                    { 
                        <li>
                            <a target="_blank" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@((int)MediaType.News)&sysID=@ViewBag.SearchResultDoc.Rows[0]["SYS_FLD_SYSID"]">
                            <img  src="@ResourceHelper.GetSmallPicURL((int)@ViewBag.DbID, @item.SYSID)"  alt="" />
                                </a>

                        </li>
                    }

                </ul>
            </div>
            <div class="baiduanniu">
                <a class="leftanniu"></a>
                <a class="rightanniu"></a>
            </div>
            <div class="xiaoyuandian">
                <ul class="xiaoyuandianul">
                    <li class="cur"></li>
                    @for (int i = 0; i < ViewBag.FileInfoHome.Count - 1; i++)
                    {
                        <li></li>
                    }
                </ul>
            </div>
        }
    </div> 
    <h2><a target="_blank" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@((int)MediaType.News)&sysID=@ViewBag.SearchResultDoc.Rows[0]["SYS_FLD_SYSID"]">
        @Html.Raw(ColumnAliasHelper.SubContent(@ColumnAliasHelper.GetContent(ViewBag.SearchResultDoc, 0, 0), @ViewBag.Len))</a></h2>
        //除了第一条都显示标题和日期
    <ul class='wrap-r-t-con'>
        @{int m = 0;
          foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
          {
              if (m != 0)
              {
            <li>
                <a target="_blank" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@((int)MediaType.News)&sysID=@dr["SYS_FLD_SYSID"]">
                    @Html.Raw(ColumnAliasHelper.SubContent(dr[0].ToString(), @ViewBag.Len))</a>
                @*<span>@Html.Raw(ColumnAliasHelper.GetContent(dr, ViewBag.DbName, "发布时间"))</span>*@

            </li>
              }
              m++;
          }

        }
    </ul>//图片新闻栏目跳转到文献概览页
    <a target="_blank" href="~/SingleSearch?id=@ViewBag.DbID&name=@ViewBag.DbName&mediaType=@((int)MediaType.Doc)&displayDBName=@ViewBag.DisplayDBName&autoLoad=1" class="more">更多</a>
            }
            else
            { //左侧模板
                string astyle = "width:210px;height:137px";
                int imgwidth = 210;
                int imgheigh = 137;
    <ul>
        @foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
        {
            <li class='col-md-4'><a target="_blank" style="@astyle" href="~/Detail?dbID=@ViewBag.DbID&dbName=@ViewBag.DbName&type=@((int)MediaType.News)&sysID=@dr["SYS_FLD_SYSID"]">
                <img width="@imgwidth" height="@imgheigh" src="@ResourceHelper.GetFirstSmallPicURL(@ViewBag.DbID, int.Parse(@dr["SYS_FLD_SYSID"].ToString()))"/></a>
                <div class="zhezhao">@Html.Raw(ColumnAliasHelper.SubContent(dr[0].ToString(), @ViewBag.Len))</div>
            </li>
        }
    </ul>
            }
        }
        else if (@ViewBag.Type == (int)ShowType.JumpTemplate)//跳转图片模板
        {

            if (@ViewBag.Location == 0)//左侧模板
            {
                // <a style="text-decoration: none; cursor: default;">友情链接</a>
                foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
                {
    <a class='inline-block' href="@dr["Url"].ToString()" target="@dr["OpenType"].ToString()" title="@dr["ShowName"].ToString()">
        <img width="150" height="56" src="@ResourceHelper.GetFirstSmallPicURL(@ViewBag.DbID, int.Parse(@dr["SYS_FLD_SYSID"].ToString()))" alt="@dr["ShowName"].ToString()" />
    </a>
                }
            }
            else //右侧模板
            {
    <ul>
        @foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
        {
            <li>
                <a href="@dr["Url"].ToString()" target="@dr["OpenType"].ToString()" title="@dr["ShowName"].ToString()">
                    @Html.Raw(ColumnAliasHelper.SubContent(dr["ShowName"].ToString(), @ViewBag.Len))
                </a>
            </li>
        }
    </ul>
            }


        }
        else if (@ViewBag.Type == (int)ShowType.JumpTemplateText)//跳转文字模板
        {

            if (@ViewBag.Location == 0)//左侧模板
            {
                //<a style="text-decoration: none; cursor: default;">友情链接</a>
                foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
                {
                    
    <a class='inline-block text-link' href="@dr["Url"].ToString()" target="@dr["OpenType"].ToString()" title="@dr["ShowName"].ToString()" >
        @Html.Raw(ColumnAliasHelper.SubContent(dr["ShowName"].ToString(), @ViewBag.Len))</a>
                }
            }
            else //右侧模板
            {
    <ul>
        @foreach (System.Data.DataRow dr in ViewBag.SearchResultDoc.Rows)
        {
            <li>
                <a href="@dr["Url"].ToString()" target="@dr["OpenType"].ToString()" title="@dr["ShowName"].ToString()">
                    @Html.Raw(ColumnAliasHelper.SubContent(dr["ShowName"].ToString(), @ViewBag.Len))
                </a>
            </li>
        }
    </ul>
            }


        }
    }

    //首页数据库列表
    if (@ViewBag.Type == -1)
    {
        int m = 0;
        int listCount = 0;
        if (ViewBag.DatabaseList != null && ViewBag.DatabaseList.Count > 0)
        {
                listCount = ViewBag.DatabaseList.Count;
        }
        if (listCount >= ViewBag.ShowDbList)
        {
    <a class="more posa pos-right" href="javascript:" id="clickshow" onclick="showul()">展开<i class="iconfont">&#xe611;</i></a>
        }
    <h2>数据库列表</h2>
    <ul class='clearfix' style='padding: 10px 0px 0px 0px;'>
        @if (ViewBag.DatabaseList != null && ViewBag.DatabaseList.Count > 0)
        {

            foreach (CNKI.TPI.Web.Search.Model.SYS_CMS_DATABASE item1 in ViewBag.DatabaseList)
            {
                  
            <li class='li-bg'><a href="~/SingleSearch?id=@item1.SysID&name=@item1.DatabaseCode&displayDBName=@Server.UrlEncode(item1.DatabaseName)">@item1.DatabaseName</a></li>
                m++;
                if (m == ViewBag.ShowDbList)
                { 
            @Html.Raw("</ul><ul class='clearfix' id='moredb' style='display:none;padding:0px'>");
                }
            }

        }
       
    </ul>

    }
}

